package com.zeratul.reactor.config;

import com.zeratul.common.core.annotation.ExcludeScan;
import com.zeratul.common.core.stype.ServerType;
import com.zeratul.common.core.stype.ServerTypeHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * 服务类型配置类
 */
@ExcludeScan
@AutoConfiguration
@Slf4j
public class ServerAutoConfiguration {

    /**
     * 单体服务
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(ServerTypeHandler.class)
    public ServerTypeHandler monoLithicHandler() {
        log.info("当前服务类型：{}", ServerType.MONOLITHIC.getName());
        return () -> ServerType.MONOLITHIC;
    }
}
